﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EstimateLib
{
    /// <summary>
    /// 域名长度等级
    /// </summary>
    public enum DomainNameLengthLevel
    {
        /// <summary>
        /// A级：域名长度小于5，如aaa等。
        /// </summary>
        A,
            /// <summary>
            /// B级：域名长度在6-10之间，如amazon等。
            /// </summary>        
        B,
            /// <summary>
            /// C级：域名长度在11-15之间，如greatdomains 
            /// </summary> 
        C,
            /// <summary>
            /// D级：域名长度在16-20之间 
            /// </summary> 
        D, 
            /// <summary>
            /// E级：域名长度在20以上 
            /// </summary> 
        E
    }

    /// <summary>
    /// 域名长度类
    /// </summary>
    public class DomainNameLength
    {
        public DomainNameLengthLevel CaculateDomainNameLengthLevel(int domainNameLength)
        {
            if (domainNameLength <= 0) throw new Exception("DomainNameLen must not less than Zero!");
            if (domainNameLength <= 5 ) return DomainNameLengthLevel.A;
            if (domainNameLength <= 10) return DomainNameLengthLevel.B;
            if (domainNameLength <= 15) return DomainNameLengthLevel.C;
            if (domainNameLength <= 20) return DomainNameLengthLevel.D;

            return DomainNameLengthLevel.E;
        }
    }
}
